 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

京东云iotcard接口
iotcard相关接口

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKIotcard/IotcardExecutor.h>

@implementation IotcardClient

@synthesize userAgent = _userAgent;
@synthesize serviceName = _serviceName;
@synthesize version = _version;

-(void) addCustomerHeaderWithKey:(NSString*) key
                           value:(NSString*) value{
    if(![self customHeader])
    {
        self.customHeader = [[NSMutableDictionary alloc] init];
    }
    if(key && value)
    {
        [[self customHeader] setValue:value forKey:key];
    }
   
}

-(id)initWithGlobalConfig{
    if(![GlobalConfig credential])
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@"GlobalConfig credential not config" userInfo:nil];
        @throw e;
    }
    self.credential = [GlobalConfig credential];
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"openapi.myiot.jdcloud.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotcard  v1";
    _serviceName = @"iotcard";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
         sdkEnvironment:(SDKEnvironment*)sdkEnvironment
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    
    if(!sdkEnvironment)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" sdkEnvironment can not null" userInfo:nil];
        @throw e;
    }else{
        self.sdkEnvironment = sdkEnvironment;
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotcard  v1";
    _serviceName = @"iotcard";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"openapi.myiot.jdcloud.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotcard  v1";
    _serviceName = @"iotcard";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)init{
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotcard  v1";
    _serviceName = @"iotcard";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}


/**
onOffStatus sync request
@param onOffStatusRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `onOffStatusResponse` the request response data model
*/
-(NSDictionary*) onOffStatusSyncWithRequest:(IotcardOnOffStatusRequest*) onOffStatusRequest
{
IotcardOnOffStatusExecutor* excutor = [[IotcardOnOffStatusExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:onOffStatusRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardOnOffStatusResponse* response = [[IotcardOnOffStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"onOffStatusResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)onOffStatusAsyncWithRequest:(IotcardOnOffStatusRequest*) onOffStatusRequest
                       completionHandler:(void(^)(int statusCode,IotcardOnOffStatusResponse* _Nullable onOffStatusResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardOnOffStatusExecutor* excutor = [[IotcardOnOffStatusExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:onOffStatusRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardOnOffStatusResponse* response = [[IotcardOnOffStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
closeIotFlow sync request
@param closeIotFlowRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `closeIotFlowResponse` the request response data model
*/
-(NSDictionary*) closeIotFlowSyncWithRequest:(IotcardCloseIotFlowRequest*) closeIotFlowRequest
{
IotcardCloseIotFlowExecutor* excutor = [[IotcardCloseIotFlowExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:closeIotFlowRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardCloseIotFlowResponse* response = [[IotcardCloseIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"closeIotFlowResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)closeIotFlowAsyncWithRequest:(IotcardCloseIotFlowRequest*) closeIotFlowRequest
                       completionHandler:(void(^)(int statusCode,IotcardCloseIotFlowResponse* _Nullable closeIotFlowResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardCloseIotFlowExecutor* excutor = [[IotcardCloseIotFlowExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:closeIotFlowRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardCloseIotFlowResponse* response = [[IotcardCloseIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
openIotCard sync request
@param openIotCardRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `openIotCardResponse` the request response data model
*/
-(NSDictionary*) openIotCardSyncWithRequest:(IotcardOpenIotCardRequest*) openIotCardRequest
{
IotcardOpenIotCardExecutor* excutor = [[IotcardOpenIotCardExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:openIotCardRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardOpenIotCardResponse* response = [[IotcardOpenIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"openIotCardResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)openIotCardAsyncWithRequest:(IotcardOpenIotCardRequest*) openIotCardRequest
                       completionHandler:(void(^)(int statusCode,IotcardOpenIotCardResponse* _Nullable openIotCardResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardOpenIotCardExecutor* excutor = [[IotcardOpenIotCardExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:openIotCardRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardOpenIotCardResponse* response = [[IotcardOpenIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
openIotFlow sync request
@param openIotFlowRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `openIotFlowResponse` the request response data model
*/
-(NSDictionary*) openIotFlowSyncWithRequest:(IotcardOpenIotFlowRequest*) openIotFlowRequest
{
IotcardOpenIotFlowExecutor* excutor = [[IotcardOpenIotFlowExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:openIotFlowRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardOpenIotFlowResponse* response = [[IotcardOpenIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"openIotFlowResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)openIotFlowAsyncWithRequest:(IotcardOpenIotFlowRequest*) openIotFlowRequest
                       completionHandler:(void(^)(int statusCode,IotcardOpenIotFlowResponse* _Nullable openIotFlowResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardOpenIotFlowExecutor* excutor = [[IotcardOpenIotFlowExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:openIotFlowRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardOpenIotFlowResponse* response = [[IotcardOpenIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
lifeStatus sync request
@param lifeStatusRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `lifeStatusResponse` the request response data model
*/
-(NSDictionary*) lifeStatusSyncWithRequest:(IotcardLifeStatusRequest*) lifeStatusRequest
{
IotcardLifeStatusExecutor* excutor = [[IotcardLifeStatusExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:lifeStatusRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardLifeStatusResponse* response = [[IotcardLifeStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"lifeStatusResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)lifeStatusAsyncWithRequest:(IotcardLifeStatusRequest*) lifeStatusRequest
                       completionHandler:(void(^)(int statusCode,IotcardLifeStatusResponse* _Nullable lifeStatusResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardLifeStatusExecutor* excutor = [[IotcardLifeStatusExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:lifeStatusRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardLifeStatusResponse* response = [[IotcardLifeStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
closeIotCard sync request
@param closeIotCardRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `closeIotCardResponse` the request response data model
*/
-(NSDictionary*) closeIotCardSyncWithRequest:(IotcardCloseIotCardRequest*) closeIotCardRequest
{
IotcardCloseIotCardExecutor* excutor = [[IotcardCloseIotCardExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:closeIotCardRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardCloseIotCardResponse* response = [[IotcardCloseIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"closeIotCardResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)closeIotCardAsyncWithRequest:(IotcardCloseIotCardRequest*) closeIotCardRequest
                       completionHandler:(void(^)(int statusCode,IotcardCloseIotCardResponse* _Nullable closeIotCardResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardCloseIotCardExecutor* excutor = [[IotcardCloseIotCardExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:closeIotCardRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardCloseIotCardResponse* response = [[IotcardCloseIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
gprsRealtimeInfo sync request
@param gprsRealtimeInfoRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `gprsRealtimeInfoResponse` the request response data model
*/
-(NSDictionary*) gprsRealtimeInfoSyncWithRequest:(IotcardGprsRealtimeInfoRequest*) gprsRealtimeInfoRequest
{
IotcardGprsRealtimeInfoExecutor* excutor = [[IotcardGprsRealtimeInfoExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:gprsRealtimeInfoRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardGprsRealtimeInfoResponse* response = [[IotcardGprsRealtimeInfoResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"gprsRealtimeInfoResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)gprsRealtimeInfoAsyncWithRequest:(IotcardGprsRealtimeInfoRequest*) gprsRealtimeInfoRequest
                       completionHandler:(void(^)(int statusCode,IotcardGprsRealtimeInfoResponse* _Nullable gprsRealtimeInfoResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardGprsRealtimeInfoExecutor* excutor = [[IotcardGprsRealtimeInfoExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:gprsRealtimeInfoRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardGprsRealtimeInfoResponse* response = [[IotcardGprsRealtimeInfoResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
gprsStatus sync request
@param gprsStatusRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `gprsStatusResponse` the request response data model
*/
-(NSDictionary*) gprsStatusSyncWithRequest:(IotcardGprsStatusRequest*) gprsStatusRequest
{
IotcardGprsStatusExecutor* excutor = [[IotcardGprsStatusExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:gprsStatusRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardGprsStatusResponse* response = [[IotcardGprsStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"gprsStatusResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)gprsStatusAsyncWithRequest:(IotcardGprsStatusRequest*) gprsStatusRequest
                       completionHandler:(void(^)(int statusCode,IotcardGprsStatusResponse* _Nullable gprsStatusResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotcardGprsStatusExecutor* excutor = [[IotcardGprsStatusExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:gprsStatusRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotcardGprsStatusResponse* response = [[IotcardGprsStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}


 /**
 iotcard common sync request
 @param  jdcloudDataRequest request param
 @return key `statusCode` http request status code type is int
             `dataResult` the http request response data  type is NSData
             `requestError` the request error type is NSError
 */
 -(NSDictionary*) iotcardCommonSyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                                   url:(NSString*) url
                                                method:(NSString*) method{
    CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    NSDictionary* responseResult = [excutor executeDataSync:jdcloudDataRequest];
    return responseResult;
}

-(void)iotcardCommonAsyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                         url:(NSString*) url
                                      method:(NSString*) method
                           completionHandler:(void(^)(int statusCode, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
     CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    
    [excutor executeDataAsync:jdcloudDataRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        completionHandler(statusCode,responseData,error);
    }];
} 

@end
